window.onload=function(){var e=window.location.href.split("?")[1];let p=new XMLHttpRequest;p.open("post","/api/project/del.php",!0),p.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p.send(`id=${e}`),p.onload=function(){wri(p.responseText),like()},$("#search").on("input",jl(1500,getSea)),$(".logoBox").find("button").on("click",linkSearch1),watch()};let a=getCookie("login"),phone=getCookie("phone");function wri(e){e=JSON.parse(e),$("title").text(e.title);let p=JSON.parse(JSON.parse(e.dis)),s=JSON.parse(e.team);for(let e=0;e<s.length;e++)"director"==s[e].role&&(s[e].role="导演"),"writer"==s[e].role&&(s[e].role="编剧");var a=JSON.parse(e.talk),t="[]"==e.win?"[]":JSON.parse(e.win);let i="";if("[]"==t)i+='<p id="none">暂无奖项</p>';else for(let e=0;e<t.length;e++)i+=`<p>${t[e].match}   ${t[e].get}</p>`;var n=Math.floor(e.rate);let l="";e.ep&&(l=`<p><span>集数: </span>${e.ep}<span id="ep"></span></p>`);a=`            <div id="left">
<div class='movie'>
    <h2>${e.title}</h2>
    <div class="movieLeft">
        <div class="poster">
            <img src="${e.poster}"
                alt="${e.title}">
        </div>
        <div class='movieText'>
            <p id="director"><span>导演: </span><span >${e.director}</span></p>
            <p id="writer"><span>编剧: </span><span >${e.writer}</span></p>
            <p id="act"><span>主演: </span><span>${e.act}</span></p>
            <p><span>类型: </span><span id="type">${e.type}</span></p>
            <p><span>制片国家/地区: </span><span id="country">${e.country}</span></p>
            <p><span>语言: </span><span id="language">${e.language}</span></p>
            <p><span>上映日期: </span><span id="date">${e.date}</span></p>
            <p id="len"><span>其他名称: </span><span >${e.othername}</span></p>
            ${l}
        </div>
    </div>
    <div class="rate">
        <p class="p">豆瓣评分</p>
        <div class='star'>
            <div id='rate'>${e.rate}</div>
            <div id='star'>
                <p class="starImg" style="background-position-y:-${22*(10-n)}px"></p>
                <p>900人评价</p>
            </div>
        </div>
        <div class="percen">
            <p>5星<i style="width:${p[0].percen1.replace("%","")}px"></i><span>${p[0].percen1}</span></p>
            <p>4星<i style="width:${p[1].percen2.replace("%","")}px"></i><span>${p[1].percen2}</span></p>
            <p>3星<i style="width:${p[2].percen3.replace("%","")}px"></i><span>${p[2].percen3}</span></p>
            <p>2星<i style="width:${p[3].percen4.replace("%","")}px"></i><span>${p[3].percen4}</span></p>
            <p>1星<i style="width:${p[4].percen5.replace("%","")}px"></i><span>${p[4].percen5}</span></p>
        </div>
    </div>
    <div class="movieFoot">
        <p>
            <button id='will' tag=${e.id}>想看</button>
            <button id='watched' tag=${e.id}>看过</button>
            

        </p>
        <p>
            <a href="#">写短评</a>
            <a href="#">写影评</a>
            <a href="#">分享到</a>
            <button>推荐</button>
        </p>
    </div>
</div>
<div class='describe'>
    <h3>${e.title}的剧情简介·····</h3>
    <p>${e.present}
    </p>
</div>
<div class='team'>
    <h3>${e.title}的演职员·····</h3>
    <div class="teamList">
        <div class='member'>
            <div class="memberImg">
                <img src="${s[0].img}"
                    alt="">
            </div>
            <p>${s[0].name}</p>
            <p>导演</p>
        </div>
        <div class='member'>
            <div class="memberImg">
                <img src="${s[1].img}"
                    alt="">
            </div>
            <p>${s[1].name}</p>
            <p>${s[1].role}</p>
        </div>
        <div class='member'>
            <div class="memberImg">
                <img src="${s[2].img}"
                    alt="">
            </div>
            <p>${s[2].name}</p>
            <p>${s[2].role}</p>
        </div>
        <div class='member'>
            <div class="memberImg">
                <img src="${s[3].img}"
                    alt="">
            </div>
            <p>${s[3].name}</p>
            <p>${s[3].role}</p>
        </div>
        <div class='member'>
            <div class="memberImg">
                <img src="${s[4].img}"
                    alt="">
            </div>
            <p>${s[4].name}</p>
            <p>${s[4].role}</p>
        </div>
        <div class='member'>
            <div class="memberImg">
                <img src="${s[5].img}"
                    alt="">
            </div>
            <p>${s[5].name}</p>
            <p>${s[5].role}</p>
        </div>
    </div>
</div>
<div class='win'>
    <h3>${e.title}的获奖情况·····</h3>
    
    ${i}
</div>
<div class='like'>
    <h3>喜欢这部影片的人也喜欢·····</h3>
    <div class="likeList">

    </div>
</div>
<div class="talk">
    <h3>${e.title}的短评·····</h3>
    <div class="talkList">
        <p><span class="username">${a[0].talkPerson}</span>于<span class="date">${a[0].talkTime}</span> 评论了:</p>
        <p>${a[0].talkContent}</p>
    </div>
    <div class="talkList">
        <p><span class="username">${a[1].talkPerson}</span>于<span class="date">${a[1].talkTime}</span> 评论了:</p>
        <p>${a[1].talkContent}</p>
    </div>
    <div class="talkList">
        <p><span class="username">${a[2].talkPerson}</span>于<span class="date">${a[2].talkTime}</span> 评论了:</p>
        <p>${a[2].talkContent}</p>
    </div>
    <div class="talkList">
        <p><span class="username">${a[3].talkPerson}</span>于<span class="date">${a[3].talkTime}</span> 评论了:</p>
        <p>${a[3].talkContent}</p>
    </div>
    <div class="talkList">
        <p><span class="username">${a[4].talkPerson}</span>于<span class="date">${a[4].talkTime}</span> 评论了:</p>
        <p>${a[4].talkContent}</p>
    </div>
</div>
</div>`;$(".all").prepend(a),$("#will").on("click",function(){let e=new XMLHttpRequest;e.open("post","/api/project/watch.php",!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send(`id=${$(this).attr("tag")}&phone=${phone}`),e.onload=function(){phone||alert("请登录后再进行该操作"),"1"==e.responseText?$("#will").addClass("light"):"0"==e.responseText&&$("#will").removeClass("light")}})}function like(){let e=new XMLHttpRequest,a=[],t=[];e.open("post","/api/project/hot.php",!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send(),e.onload=function(){var p=JSON.parse(e.responseText);for(let e=0;e<50;e++){var s=ranNum(0,p.length-1);-1==a.indexOf(s)?(a.push(s),t.push(p[s])):e--}likeWrite(t.slice(0,10))}}function likeWrite(p){let s="";for(let e=0;e<p.length;e++)s+=`<div class="likeMovie" uid=${p[e].id}>
        <div class="likePoster"><img
                src="${p[e].poster}"
                alt=""></div>
        <p class="likeTitle">${p[e].title}</p>
        </div>`;$(".likeList").append(s),link1($(".likeMovie"))}function watch(){let e=new XMLHttpRequest;e.open("post","/api/project/watch1.php",!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.send(`id=${window.location.href.split("?")[1]}&phone=${phone}`),e.onload=function(){"1"==e.responseText?$("#will").addClass("light"):"0"==e.responseText&&$("#will").removeClass("light")}}a&&phone&&$(".lo").html(`<a href='watchList.html'>欢迎你${a}</a>`);